// Decompiled by GOOSIN CO,LTD Copyright 2010 Pavel Kouznetsov.
// home page: http://www.Goosin.net
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   ProcesserCharacterStream.java

package include.nseer_cookie;

import java.io.*;

public class ProcesserCharacterStream
{

	public ProcesserCharacterStream()
	{
	}

	public static void main(String args[])
		throws FileNotFoundException, IOException
	{
		FileInputStream fileInStream = new FileInputStream("d:\\secondFile.txt");
		InputStreamReader inputReader = new InputStreamReader(fileInStream);
		BufferedReader bufReader = new BufferedReader(inputReader);
		System.out.println("------------------------------------------------");
		System.out.println("There are file content before modify:");
		String lineStr;
		while ((lineStr = bufReader.readLine()) != null) 
			System.out.println(lineStr);
		bufReader.close();
		inputReader.close();
		fileInStream.close();
		FileOutputStream fileOutStream = new FileOutputStream("d:\\secondFile.txt");
		OutputStreamWriter outputWriter = new OutputStreamWriter(fileOutStream);
		BufferedWriter bufWriter = new BufferedWriter(outputWriter);
		String newStr = new String("Modify the file ! \r\nThis is a nice thing. \r\nWe can write anything.");
		bufWriter.write(newStr, 0, newStr.length());
		System.out.println(newStr);
		bufWriter.close();
		outputWriter.close();
		fileOutStream.close();
		fileInStream = new FileInputStream("d:\\secondFile.txt");
		inputReader = new InputStreamReader(fileInStream);
		bufReader = new BufferedReader(inputReader);
		System.out.println("------------------------------------------------");
		System.out.println("There are file content after modify:");
		while ((lineStr = bufReader.readLine()) != null) 
			System.out.println(lineStr);
		bufReader.close();
		inputReader.close();
		fileInStream.close();
	}
}
